Don't hide flymake diagnostics on empty first line (bug#70310)
authorMattias Engdegård <mattiase@acm.org>
Thu, 11 Apr 2024 11:55:39 +0000 (13:55 +0200)
committerMattias Engdegård <mattiase@acm.org>
Thu, 11 Apr 2024 11:55:39 +0000 (13:55 +0200)
A diagnostic first in the buffer, typically the lexical cookie warning,
got lost if that line was empty.

* lisp/progmodes/elisp-mode.el (elisp-flymake--byte-compile-done):
Make sure the location interval doesn't go beyond the buffer bounds.

lisp/progmodes/elisp-mode.el

index 9b4c3f994cd6ebcf36b44159ea36e8dd161656cc..3383841391deb2c495e7e5366c5efc61a2e28e6e 100644 (file)
@@ -2151,8 +2151,13 @@ Calls REPORT-FN directly."
                                  (point-max)))
                   collect (flymake-make-diagnostic
                            (current-buffer)
-                           (if (= beg end) (1- beg) beg)
-                           end
+                           (if (= beg end)
+                               (max (1- beg) (point-min))
+                             beg)
+                           (if (= beg end)
+                               (min (max beg (1+ (point-min)))
+                                    (point-max))
+                             end)
                            level
                            string)))))))